package com.apptest.android.ui.navigation;

import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;

import com.apptest.android.core.bean.NavigationTagBean;
import com.apptest.android.core.network.ApiEngine;
import com.apptest.android.core.network.BaseObserver;

import java.util.List;

public class NavigationViewModel extends ViewModel {

    private MutableLiveData<List<NavigationTagBean>> navigationList;

    public NavigationViewModel() {
        navigationList = new MutableLiveData<>();
        updateNavigationList();
    }

    public LiveData<List<NavigationTagBean>> getNavigationList() {
        return navigationList;
    }

    private void updateNavigationList(){
        ApiEngine.getNavigationData(new BaseObserver<List<NavigationTagBean>>() {
            @Override
            public void onSuccess(List<NavigationTagBean> list) {
                navigationList.setValue(list);
            }
        });
    }
}